/*      */ package change.org.eclipse.swt.browser;
/*      */ 
/*      */ import java.io.PrintStream;
/*      */ import java.net.URI;
/*      */ import java.net.URISyntaxException;
/*      */ import org.eclipse.swt.SWT;
/*      */ import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;
import org.eclipse.swt.browser.TitleListener;
/*      */ import org.eclipse.swt.graphics.Point;
/*      */ import org.eclipse.swt.graphics.Rectangle;
/*      */ import org.eclipse.swt.layout.FillLayout;
/*      */ import org.eclipse.swt.widgets.Composite;
/*      */ import org.eclipse.swt.widgets.Display;
/*      */ import org.eclipse.swt.widgets.Event;
/*      */ import org.eclipse.swt.widgets.Label;
/*      */ import org.eclipse.swt.widgets.Listener;
/*      */ import org.eclipse.swt.widgets.Menu;
/*      */ import org.eclipse.swt.widgets.Shell;
/*      */ import org.mozilla.interfaces.nsIAppShell;
/*      */ import org.mozilla.interfaces.nsIBaseWindow;
/*      */ import org.mozilla.interfaces.nsIComponentManager;
/*      */ import org.mozilla.interfaces.nsIComponentRegistrar;
/*      */ import org.mozilla.interfaces.nsIContextMenuListener;
/*      */ import org.mozilla.interfaces.nsIDOMDocument;
/*      */ import org.mozilla.interfaces.nsIDOMEvent;
/*      */ import org.mozilla.interfaces.nsIDOMHTMLDocument;
/*      */ import org.mozilla.interfaces.nsIDOMMouseEvent;
/*      */ import org.mozilla.interfaces.nsIDOMNode;
/*      */ import org.mozilla.interfaces.nsIDOMWindow;
/*      */ import org.mozilla.interfaces.nsIEmbeddingSiteWindow;
/*      */ import org.mozilla.interfaces.nsIInterfaceRequestor;
/*      */ import org.mozilla.interfaces.nsIRequest;
/*      */ import org.mozilla.interfaces.nsIServiceManager;
/*      */ import org.mozilla.interfaces.nsIStreamListener;
/*      */ import org.mozilla.interfaces.nsISupports;
/*      */ import org.mozilla.interfaces.nsITooltipListener;
/*      */ import org.mozilla.interfaces.nsIURI;
/*      */ import org.mozilla.interfaces.nsIURIContentListener;
/*      */ import org.mozilla.interfaces.nsIWebBrowser;
/*      */ import org.mozilla.interfaces.nsIWebBrowserChrome;
/*      */ import org.mozilla.interfaces.nsIWebBrowserChromeFocus;
/*      */ import org.mozilla.interfaces.nsIWebBrowserFocus;
/*      */ import org.mozilla.interfaces.nsIWebNavigation;
/*      */ import org.mozilla.interfaces.nsIWebProgress;
/*      */ import org.mozilla.interfaces.nsIWebProgressListener;
/*      */ import org.mozilla.interfaces.nsIWindowWatcher;
/*      */ import org.mozilla.xpcom.Mozilla;
import org.mozilla.xpcom.XPCOMException;

import change.org.eclipse.swt.browser.mozilla.core.MozillaHelper;
/*      */ 
/*      */ public abstract class AbstractMozillaBrowser extends Composite
/*      */   implements nsIWebProgressListener, nsIWebBrowserChrome, nsIWebBrowserChromeFocus, nsIInterfaceRequestor, nsIContextMenuListener, nsIURIContentListener, nsITooltipListener
/*      */ {
/*      */   public static final String NS_APPSHELL_CID = "{2d96b3df-c051-11d1-a827-0040959a28c9}";
/*      */   public static final String NS_IOSERVICE_CID = "{9ac9e770-18bc-11d3-9337-00104ba0fd40}";
/*      */   public static final String NS_INPUTSTREAMCHANNEL_CID = "{6ddb050c-0d04-11d4-986e-00c04fa0cf4a}";
/*      */   public static final String NS_LOADGROUP_CID = "{e1c61582-2a84-11d3-8cce-0060b0fc14a3}";
/*      */   public static final String NS_PROMPTSERVICE_CID = "{a2112d6a-0e28-421f-b46a-25c0b308cbd0}";
/*      */   public static final String NS_HELPERAPPLAUNCHERDIALOG_CID = "{f68578eb-6ec2-4169-ae19-8c6243f0abe1}";
/*      */   public static final String NS_DOWNLOAD_CID = "{e3fa9D0a-1dd1-11b2-bdef-8c720b597445}";
/*      */   public static final String NS_CATEGORYMANAGER_CONTRACTID = "@mozilla.org/categorymanager;1";
/*      */   public static final String NS_MEMORY_CONTRACTID = "@mozilla.org/xpcom/memory-service;1";
/*      */   public static final String NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1";
/*      */   public static final String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1";
/*      */   public static final String NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID = "@mozilla.org/helperapplauncherdialog;1";
/*      */   public static final String NS_DOWNLOAD_CONTRACTID = "@mozilla.org/download;1";
/*      */   nsIWebBrowser webBrowser;
/*      */   nsIEmbeddingSiteWindow embeddingSiteWin;
/*  112 */   long chromeFlags = 1L;
/*      */   nsIRequest request;
/*      */   Point location;
/*      */   Point size;
/*      */   boolean addressBar;
/*      */   boolean menuBar;
/*      */   boolean statusBar;
/*      */   boolean toolBar;
/*      */   boolean visible;
/*  124 */   Shell tip = null;
/*      */ 
/*  127 */   MozillaCloseWindowListener[] closeWindowListeners = new MozillaCloseWindowListener[0];
/*      */ 
/*  129 */   LocationListener[] locationListeners = new LocationListener[0];
/*      */ 
/*  131 */   MozillaOpenWindowListener[] openWindowListeners = new MozillaOpenWindowListener[0];
/*      */ 
/*  133 */   ProgressListener[] progressListeners = new ProgressListener[0];
/*      */ 
/*  135 */   StatusTextListener[] statusTextListeners = new StatusTextListener[0];
/*      */ 
/*  137 */   TitleListener[] titleListeners = new TitleListener[0];
/*      */ 
/*  139 */   MozillaVisibilityWindowListener[] visibilityWindowListeners = new MozillaVisibilityWindowListener[0];
/*      */   static nsIAppShell AppShell;
/*      */   static MozillaWindowCreator WindowCreator;
/*      */   static int BrowserCount;
/*      */   static boolean mozilla;
/*      */   static final String PACKAGE_PREFIX = "change.org.eclipse.swt.browser.";
/*      */ 
/*      */   public AbstractMozillaBrowser(Composite parent, int style)
/*      */   {
/*  190 */     super(parent, style);
/*      */ 
/*  192 */     Mozilla Moz = null;
/*      */     try {
/*  194 */       Moz = MozillaHelper.getMozillaInstance();
/*      */     }
/*      */     catch (Exception e) {
/*  197 */       e.printStackTrace();
/*  198 */       dispose();
/*  199 */       SWT.error(47);
/*      */     }
/*      */ 
			   nsIComponentManager componentManager;
/*  203 */     if ((!(mozilla)) && (Moz != null))
/*      */     {
/*  205 */       componentManager = Moz.getComponentManager();
/*      */ 
/*  207 */       AppShell = (nsIAppShell)componentManager.createInstance(
/*  208 */         "{2d96b3df-c051-11d1-a827-0040959a28c9}", null, "{a0757c31-eeac-11d1-9ec1-00aa002fb821}");
/*      */ 
/*  214 */       WindowCreator = new MozillaWindowCreator();
/*      */ 
/*  216 */       nsIServiceManager serviceManager = Moz.getServiceManager();
/*      */ 
/*  218 */       nsIWindowWatcher windowWatcher = (nsIWindowWatcher)serviceManager
/*  219 */         .getServiceByContractID("@mozilla.org/embedcomp/window-watcher;1", 
/*  220 */         "{002286a8-494b-43b3-8ddd-49e3fc50622b}");
/*  221 */       windowWatcher.setWindowCreator(WindowCreator);
/*      */ 
/*  223 */       MozillaPromptServiceFactory factory = new MozillaPromptServiceFactory();
/*      */ 
/*  225 */       nsIComponentRegistrar componentRegistrar = Moz
/*  226 */         .getComponentRegistrar();
/*  227 */       componentRegistrar.registerFactory("{a2112d6a-0e28-421f-b46a-25c0b308cbd0}", 
/*  228 */         "Prompt Service", "@mozilla.org/embedcomp/prompt-service;1", factory);
/*      */ 
/*  230 */       MozillaHelperAppLauncherDialogFactory dialogFactory = new MozillaHelperAppLauncherDialogFactory();
/*  231 */       componentRegistrar.registerFactory("{f68578eb-6ec2-4169-ae19-8c6243f0abe1}", 
/*  232 */         "Helper App Launcher Dialog", 
/*  233 */         "@mozilla.org/helperapplauncherdialog;1", dialogFactory);
/*      */ 
/*  235 */       MozillaDownloadFactory downloadFactory = new MozillaDownloadFactory();
/*  236 */       componentRegistrar.registerFactory("{e3fa9D0a-1dd1-11b2-bdef-8c720b597445}", "Download", 
/*  237 */         "@mozilla.org/download;1", downloadFactory);
/*      */ 
/*  239 */       mozilla = true;
/*      */     }
/*      */ 
/*  242 */     BrowserCount += 1;
/*      */ 
/*  244 */     componentManager = Moz.getComponentManager();
/*      */ 
/*  246 */     String NS_IWEBBROWSER_CID = "F1EAC761-87E9-11d3-AF80-00A024FFC08C";
/*  247 */     this.webBrowser = 
/*  248 */       ((nsIWebBrowser)componentManager
/*  248 */       .createInstance(NS_IWEBBROWSER_CID, null, "{69e5df00-7b8b-11d3-af61-00a024ffc08c}"));
/*  249 */     this.webBrowser.setContainerWindow(this);
/*      */ 
/*  251 */     nsIBaseWindow baseWindow = (nsIBaseWindow)this.webBrowser
/*  252 */       .queryInterface("{046bc8a0-8015-11d3-af70-00a024ffc08c}");
/*      */ 
/*  254 */     Rectangle rect = getClientArea();
/*  255 */     if (rect.isEmpty()) {
/*  256 */       rect.width = 1;
/*  257 */       rect.height = 1;
/*      */     }
/*      */ 
/*  260 */     baseWindow.initWindow(getHandle(), 0L, 0, 0, rect.width, rect.height);
/*  261 */     baseWindow.create();
/*  262 */     baseWindow.setVisibility(true);
/*      */ 
/*  264 */     this.webBrowser.addWebBrowserListener(this, 
/*  265 */       "{570f39d1-efd0-11d3-b093-00a024ffc08c}");
/*  266 */     this.webBrowser.setParentURIContentListener(this);
/*      */ 
/*  268 */     Listener listener = new Listener() {
/*      */       public void handleEvent(Event event) {
/*  270 */         switch (event.type)
/*      */         {
/*      */         case 12:
/*  272 */           AbstractMozillaBrowser.this.onDispose();
/*  273 */           break;
/*      */         case 11:
/*  275 */           AbstractMozillaBrowser.this.onResize();
/*  276 */           break;
/*      */         case 15:
/*  278 */           AbstractMozillaBrowser.this.activate();
/*  279 */           break;
/*      */         case 27:
/*  281 */           Display display = event.display;
/*  282 */           if (AbstractMozillaBrowser.this != 
/*  283 */             display.getFocusControl()) return;
/*  284 */           AbstractMozillaBrowser.this.deactivate();
/*  285 */           break;
/*      */         case 22:
/*  288 */           AbstractMozillaBrowser.this.onShow(event);
/*      */         }
/*      */       }
/*      */     };
/*  294 */     int[] folderEvents = { 12, 11, 15, 
/*  295 */       1, 27, 22 };
/*  296 */     for (int i = 0; i < folderEvents.length; ++i)
/*  297 */       addListener(folderEvents[i], listener);
/*      */   }
/*      */ 
/*      */   protected abstract int getHandle();
/*      */ 
/*      */   protected abstract void onShow(Event paramEvent);
/*      */ 
/*      */   public void addCloseWindowListener(MozillaCloseWindowListener listener)
/*      */   {
/*  328 */     checkWidget();
/*  329 */     if (listener == null)
/*  330 */       SWT.error(4);
/*  331 */     MozillaCloseWindowListener[] newCloseWindowListeners = new MozillaCloseWindowListener[this.closeWindowListeners.length + 1];
/*  332 */     System.arraycopy(this.closeWindowListeners, 0, newCloseWindowListeners, 0, 
/*  333 */       this.closeWindowListeners.length);
/*  334 */     this.closeWindowListeners = newCloseWindowListeners;
/*  335 */     this.closeWindowListeners[(this.closeWindowListeners.length - 1)] = listener;
/*      */   }
/*      */ 
/*      */   public void addLocationListener(LocationListener listener)
/*      */   {
/*  361 */     checkWidget();
/*  362 */     if (listener == null)
/*  363 */       SWT.error(4);
/*  364 */     LocationListener[] newLocationListeners = new LocationListener[this.locationListeners.length + 1];
/*  365 */     System.arraycopy(this.locationListeners, 0, newLocationListeners, 0, 
/*  366 */       this.locationListeners.length);
/*  367 */     this.locationListeners = newLocationListeners;
/*  368 */     this.locationListeners[(this.locationListeners.length - 1)] = listener;
/*      */   }
/*      */ 
/*      */   public void addOpenWindowListener(MozillaOpenWindowListener listener)
/*      */   {
/*  394 */     checkWidget();
/*  395 */     if (listener == null)
/*  396 */       SWT.error(4);
/*  397 */     MozillaOpenWindowListener[] newOpenWindowListeners = new MozillaOpenWindowListener[this.openWindowListeners.length + 1];
/*  398 */     System.arraycopy(this.openWindowListeners, 0, newOpenWindowListeners, 0, 
/*  399 */       this.openWindowListeners.length);
/*  400 */     this.openWindowListeners = newOpenWindowListeners;
/*  401 */     this.openWindowListeners[(this.openWindowListeners.length - 1)] = listener;
/*      */   }
/*      */ 
/*      */   public void addProgressListener(ProgressListener listener)
/*      */   {
/*  427 */     checkWidget();
/*  428 */     if (listener == null)
/*  429 */       SWT.error(4);
/*  430 */     ProgressListener[] newProgressListeners = new ProgressListener[this.progressListeners.length + 1];
/*  431 */     System.arraycopy(this.progressListeners, 0, newProgressListeners, 0, 
/*  432 */       this.progressListeners.length);
/*  433 */     this.progressListeners = newProgressListeners;
/*  434 */     this.progressListeners[(this.progressListeners.length - 1)] = listener;
/*      */   }
/*      */ 
/*      */   public void addStatusTextListener(StatusTextListener listener)
/*      */   {
/*  460 */     checkWidget();
/*  461 */     if (listener == null)
/*  462 */       SWT.error(4);
/*  463 */     StatusTextListener[] newStatusTextListeners = new StatusTextListener[this.statusTextListeners.length + 1];
/*  464 */     System.arraycopy(this.statusTextListeners, 0, newStatusTextListeners, 0, 
/*  465 */       this.statusTextListeners.length);
/*  466 */     this.statusTextListeners = newStatusTextListeners;
/*  467 */     this.statusTextListeners[(this.statusTextListeners.length - 1)] = listener;
/*      */   }
/*      */ 
/*      */   public void addTitleListener(TitleListener listener)
/*      */   {
/*  493 */     checkWidget();
/*  494 */     if (listener == null)
/*  495 */       SWT.error(4);
/*  496 */     TitleListener[] newTitleListeners = new TitleListener[this.titleListeners.length + 1];
/*  497 */     System.arraycopy(this.titleListeners, 0, newTitleListeners, 0, 
/*  498 */       this.titleListeners.length);
/*  499 */     this.titleListeners = newTitleListeners;
/*  500 */     this.titleListeners[(this.titleListeners.length - 1)] = listener;
/*      */   }
/*      */ 
/*      */   public void addVisibilityWindowListener(MozillaVisibilityWindowListener listener)
/*      */   {
/*  527 */     checkWidget();
/*  528 */     if (listener == null)
/*  529 */       SWT.error(4);
/*  530 */     MozillaVisibilityWindowListener[] newVisibilityWindowListeners = new MozillaVisibilityWindowListener[this.visibilityWindowListeners.length + 1];
/*  531 */     System.arraycopy(this.visibilityWindowListeners, 0, 
/*  532 */       newVisibilityWindowListeners, 0, 
/*  533 */       this.visibilityWindowListeners.length);
/*  534 */     this.visibilityWindowListeners = newVisibilityWindowListeners;
/*  535 */     this.visibilityWindowListeners[(this.visibilityWindowListeners.length - 1)] = listener;
/*      */   }
/*      */ 
/*      */   public boolean back()
/*      */   {
/*  557 */     checkWidget();
/*  558 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/*  559 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*  560 */     webNavigation.goBack();
/*  561 */     return true;
/*      */   }
/*      */ 
/*      */   protected void checkSubclass() {
/*  565 */     String name = super.getClass().getName();
/*  566 */     int index = name.lastIndexOf(46);
/*  567 */     if (!(name.substring(0, index + 1).equals("change.org.eclipse.swt.browser.")))
/*  568 */       SWT.error(43);
/*      */   }
/*      */ 
/*      */   public boolean execute(String aScript)
/*      */   {
/*  573 */     checkWidget();
/*  574 */     if (aScript == null) {
/*  575 */       SWT.error(4);
/*      */     }
/*  577 */     String url = "javascript:" + aScript + ";void(0);";
/*  578 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/*  579 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*  580 */     if (webNavigation == null) {
/*  581 */       error(2147500034L);
/*      */     }
/*  583 */     webNavigation.loadURI(url, 0L, null, 
/*  584 */       null, null);
/*  585 */     return true;
/*      */   }
/*      */ 
/*      */   public boolean forward()
/*      */   {
/*  607 */     checkWidget();
/*  608 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/*  609 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*  610 */     webNavigation.goForward();
/*  611 */     return true;
/*      */   }
/*      */ 
/*      */   public String getUrl()
/*      */   {
/*  633 */     checkWidget();
/*      */ 
/*  635 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/*  636 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*  637 */     nsIURI uri = webNavigation.getCurrentURI();
/*  638 */     String spec = "";
/*  639 */     if (uri != null) {
/*  640 */       spec = uri.getSpec();
/*      */     }
/*  642 */     return spec;
/*      */   }
/*      */ 
/*      */   public boolean isBackEnabled()
/*      */   {
/*  662 */     checkWidget();
/*  663 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/*  664 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*  665 */     boolean aCanGoBack = webNavigation.getCanGoBack();
/*  666 */     return aCanGoBack;
/*      */   }
/*      */ 
/*      */   public boolean isForwardEnabled()
/*      */   {
/*  686 */     checkWidget();
/*  687 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/*  688 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*  689 */     boolean aCanGoForward = webNavigation.getCanGoForward();
/*  690 */     return aCanGoForward;
/*      */   }
/*      */ 
/*      */   static String error(long code) {
/*  694 */     throw new SWTError("XPCOM error " + code);
/*      */   }
/*      */ 
/*      */   void onDispose() {
/*  698 */     this.webBrowser.removeWebBrowserListener(this, 
/*  699 */       "{570f39d1-efd0-11d3-b093-00a024ffc08c}");
/*  700 */     this.webBrowser.setParentURIContentListener(null);
/*      */ 
/*  702 */     nsIBaseWindow baseWindow = (nsIBaseWindow)this.webBrowser
/*  703 */       .queryInterface("{046bc8a0-8015-11d3-af70-00a024ffc08c}");
/*  704 */     baseWindow.destroy();
/*      */ 
/*  706 */     onHideTooltip();
/*      */ 
/*  708 */     BrowserCount -= 1;
/*      */   }
/*      */ 
/*      */   void activate()
/*      */   {
/*  731 */     nsIWebBrowserFocus webBrowserFocus = (nsIWebBrowserFocus)this.webBrowser
/*  732 */       .queryInterface("{9c5d3c58-1dd1-11b2-a1c9-f3699284657a}");
/*  733 */     webBrowserFocus.activate();
/*      */   }
/*      */ 
/*      */   void deactivate() {
/*  737 */     nsIWebBrowserFocus webBrowserFocus = (nsIWebBrowserFocus)this.webBrowser
/*  738 */       .queryInterface("{9c5d3c58-1dd1-11b2-a1c9-f3699284657a}");
/*  739 */     webBrowserFocus.deactivate();
/*      */   }
/*      */ 
/*      */   void setFocusAtFirstElement() {
/*  743 */     nsIWebBrowserFocus webBrowserFocus = (nsIWebBrowserFocus)this.webBrowser
/*  744 */       .queryInterface("{9c5d3c58-1dd1-11b2-a1c9-f3699284657a}");
/*  745 */     webBrowserFocus.setFocusAtFirstElement();
/*      */   }
/*      */ 
/*      */   abstract void onResize();
/*      */ 
/*      */   public void refresh()
/*      */   {
/*  764 */     checkWidget();
/*  765 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/*  766 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*      */     try
/*      */     {
/*  769 */       webNavigation.reload(0L);
/*      */     }
/*      */     catch (XPCOMException e)
/*      */     {
/*  777 */       if (e.errorcode != 2147500035L)
/*  778 */         throw e;
/*      */     }
/*      */   }
/*      */ 
/*      */   public void removeCloseWindowListener(MozillaCloseWindowListener listener)
/*      */   {
/*  804 */     checkWidget();
/*  805 */     if (listener == null)
/*  806 */       SWT.error(4);
/*  807 */     if (this.closeWindowListeners.length == 0)
/*  808 */       return;
/*  809 */     int index = -1;
/*  810 */     for (int i = 0; i < this.closeWindowListeners.length; ++i) {
/*  811 */       if (listener == this.closeWindowListeners[i]) {
/*  812 */         index = i;
/*  813 */         break;
/*      */       }
/*      */     }
/*  816 */     if (index == -1)
/*  817 */       return;
/*  818 */     if (this.closeWindowListeners.length == 1) {
/*  819 */       this.closeWindowListeners = new MozillaCloseWindowListener[0];
/*  820 */       return;
/*      */     }
/*      */ 
/*  823 */     MozillaCloseWindowListener[] newCloseWindowListeners = new MozillaCloseWindowListener[this.closeWindowListeners.length - 1];
/*  824 */     System.arraycopy(this.closeWindowListeners, 0, newCloseWindowListeners, 0, 
/*  825 */       index);
/*  826 */     System.arraycopy(this.closeWindowListeners, index + 1, 
/*  827 */       newCloseWindowListeners, index, this.closeWindowListeners.length - 
/*  828 */       index - 1);
/*  829 */     this.closeWindowListeners = newCloseWindowListeners;
/*      */   }
/*      */ 
/*      */   public void removeLocationListener(LocationListener listener)
/*      */   {
/*  854 */     checkWidget();
/*  855 */     if (listener == null)
/*  856 */       SWT.error(4);
/*  857 */     if (this.locationListeners.length == 0)
/*  858 */       return;
/*  859 */     int index = -1;
/*  860 */     for (int i = 0; i < this.locationListeners.length; ++i) {
/*  861 */       if (listener == this.locationListeners[i]) {
/*  862 */         index = i;
/*  863 */         break;
/*      */       }
/*      */     }
/*  866 */     if (index == -1)
/*  867 */       return;
/*  868 */     if (this.locationListeners.length == 1) {
/*  869 */       this.locationListeners = new LocationListener[0];
/*  870 */       return;
/*      */     }
/*      */ 
/*  873 */     LocationListener[] newLocationListeners = new LocationListener[this.locationListeners.length - 1];
/*  874 */     System.arraycopy(this.locationListeners, 0, newLocationListeners, 0, index);
/*  875 */     System.arraycopy(this.locationListeners, index + 1, newLocationListeners, 
/*  876 */       index, this.locationListeners.length - index - 1);
/*  877 */     this.locationListeners = newLocationListeners;
/*      */   }
/*      */ 
/*      */   public void removeOpenWindowListener(MozillaOpenWindowListener listener)
/*      */   {
/*  902 */     checkWidget();
/*  903 */     if (listener == null)
/*  904 */       SWT.error(4);
/*  905 */     if (this.openWindowListeners.length == 0)
/*  906 */       return;
/*  907 */     int index = -1;
/*  908 */     for (int i = 0; i < this.openWindowListeners.length; ++i) {
/*  909 */       if (listener == this.openWindowListeners[i]) {
/*  910 */         index = i;
/*  911 */         break;
/*      */       }
/*      */     }
/*  914 */     if (index == -1)
/*  915 */       return;
/*  916 */     if (this.openWindowListeners.length == 1) {
/*  917 */       this.openWindowListeners = new MozillaOpenWindowListener[0];
/*  918 */       return;
/*      */     }
/*      */ 
/*  921 */     MozillaOpenWindowListener[] newOpenWindowListeners = new MozillaOpenWindowListener[this.openWindowListeners.length - 1];
/*  922 */     System.arraycopy(this.openWindowListeners, 0, newOpenWindowListeners, 0, 
/*  923 */       index);
/*  924 */     System.arraycopy(this.openWindowListeners, index + 1, 
/*  925 */       newOpenWindowListeners, index, this.openWindowListeners.length - 
/*  926 */       index - 1);
/*  927 */     this.openWindowListeners = newOpenWindowListeners;
/*      */   }
/*      */ 
/*      */   public void removeProgressListener(ProgressListener listener)
/*      */   {
/*  952 */     checkWidget();
/*  953 */     if (listener == null)
/*  954 */       SWT.error(4);
/*  955 */     if (this.progressListeners.length == 0)
/*  956 */       return;
/*  957 */     int index = -1;
/*  958 */     for (int i = 0; i < this.progressListeners.length; ++i) {
/*  959 */       if (listener == this.progressListeners[i]) {
/*  960 */         index = i;
/*  961 */         break;
/*      */       }
/*      */     }
/*  964 */     if (index == -1)
/*  965 */       return;
/*  966 */     if (this.progressListeners.length == 1) {
/*  967 */       this.progressListeners = new ProgressListener[0];
/*  968 */       return;
/*      */     }
/*      */ 
/*  971 */     ProgressListener[] newProgressListeners = new ProgressListener[this.progressListeners.length - 1];
/*  972 */     System.arraycopy(this.progressListeners, 0, newProgressListeners, 0, index);
/*  973 */     System.arraycopy(this.progressListeners, index + 1, newProgressListeners, 
/*  974 */       index, this.progressListeners.length - index - 1);
/*  975 */     this.progressListeners = newProgressListeners;
/*      */   }
/*      */ 
/*      */   public void removeStatusTextListener(StatusTextListener listener)
/*      */   {
/* 1000 */     checkWidget();
/* 1001 */     if (listener == null)
/* 1002 */       SWT.error(4);
/* 1003 */     if (this.statusTextListeners.length == 0)
/* 1004 */       return;
/* 1005 */     int index = -1;
/* 1006 */     for (int i = 0; i < this.statusTextListeners.length; ++i) {
/* 1007 */       if (listener == this.statusTextListeners[i]) {
/* 1008 */         index = i;
/* 1009 */         break;
/*      */       }
/*      */     }
/* 1012 */     if (index == -1)
/* 1013 */       return;
/* 1014 */     if (this.statusTextListeners.length == 1) {
/* 1015 */       this.statusTextListeners = new StatusTextListener[0];
/* 1016 */       return;
/*      */     }
/*      */ 
/* 1019 */     StatusTextListener[] newStatusTextListeners = new StatusTextListener[this.statusTextListeners.length - 1];
/* 1020 */     System.arraycopy(this.statusTextListeners, 0, newStatusTextListeners, 0, 
/* 1021 */       index);
/* 1022 */     System.arraycopy(this.statusTextListeners, index + 1, 
/* 1023 */       newStatusTextListeners, index, this.statusTextListeners.length - 
/* 1024 */       index - 1);
/* 1025 */     this.statusTextListeners = newStatusTextListeners;
/*      */   }
/*      */ 
/*      */   public void removeTitleListener(TitleListener listener)
/*      */   {
/* 1050 */     checkWidget();
/* 1051 */     if (listener == null)
/* 1052 */       SWT.error(4);
/* 1053 */     if (this.titleListeners.length == 0)
/* 1054 */       return;
/* 1055 */     int index = -1;
/* 1056 */     for (int i = 0; i < this.titleListeners.length; ++i) {
/* 1057 */       if (listener == this.titleListeners[i]) {
/* 1058 */         index = i;
/* 1059 */         break;
/*      */       }
/*      */     }
/* 1062 */     if (index == -1)
/* 1063 */       return;
/* 1064 */     if (this.titleListeners.length == 1) {
/* 1065 */       this.titleListeners = new TitleListener[0];
/* 1066 */       return;
/*      */     }
/*      */ 
/* 1069 */     TitleListener[] newTitleListeners = new TitleListener[this.titleListeners.length - 1];
/* 1070 */     System.arraycopy(this.titleListeners, 0, newTitleListeners, 0, index);
/* 1071 */     System.arraycopy(this.titleListeners, index + 1, newTitleListeners, index, 
/* 1072 */       this.titleListeners.length - index - 1);
/* 1073 */     this.titleListeners = newTitleListeners;
/*      */   }
/*      */ 
/*      */   public void removeVisibilityWindowListener(MozillaVisibilityWindowListener listener)
/*      */   {
/* 1099 */     checkWidget();
/* 1100 */     if (listener == null)
/* 1101 */       SWT.error(4);
/* 1102 */     if (this.visibilityWindowListeners.length == 0)
/* 1103 */       return;
/* 1104 */     int index = -1;
/* 1105 */     for (int i = 0; i < this.visibilityWindowListeners.length; ++i) {
/* 1106 */       if (listener == this.visibilityWindowListeners[i]) {
/* 1107 */         index = i;
/* 1108 */         break;
/*      */       }
/*      */     }
/* 1111 */     if (index == -1)
/* 1112 */       return;
/* 1113 */     if (this.visibilityWindowListeners.length == 1) {
/* 1114 */       this.visibilityWindowListeners = new MozillaVisibilityWindowListener[0];
/* 1115 */       return;
/*      */     }
/*      */ 
/* 1118 */     MozillaVisibilityWindowListener[] newVisibilityWindowListeners = new MozillaVisibilityWindowListener[this.visibilityWindowListeners.length - 1];
/* 1119 */     System.arraycopy(this.visibilityWindowListeners, 0, 
/* 1120 */       newVisibilityWindowListeners, 0, index);
/* 1121 */     System.arraycopy(this.visibilityWindowListeners, index + 1, 
/* 1122 */       newVisibilityWindowListeners, index, 
/* 1123 */       this.visibilityWindowListeners.length - index - 1);
/* 1124 */     this.visibilityWindowListeners = newVisibilityWindowListeners;
/*      */   }
/*      */ 
/*      */   public boolean setText(String html)
/*      */   {
/* 1153 */     checkWidget();
/* 1154 */     if (html == null) {
/* 1155 */       SWT.error(4);
/*      */     }
/*      */ 
/* 1174 */     if (this != getDisplay().getFocusControl()) {
/* 1175 */       deactivate();
/*      */     }
/* 1177 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/* 1178 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*      */ 
/* 1187 */     webNavigation.stop(3L);
/* 1188 */     webNavigation
/* 1189 */       .loadURI(
/* 1190 */       "data:text/html," + html, 0L, null, null, null);
/*      */ 
/* 1192 */     return true;
/*      */   }
/*      */ 
/*      */   public boolean setUrl(String url)
/*      */   {
/* 1222 */     checkWidget();
/* 1223 */     if (url == null) {
/* 1224 */       SWT.error(4);
/*      */     }
/* 1226 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/* 1227 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/*      */     try
/*      */     {
/* 1230 */       URI uri = new URI(url);
/* 1231 */       url = uri.toString();
/*      */     }
/*      */     catch (URISyntaxException localURISyntaxException)
/*      */     {
/*      */     }
/* 1236 */     webNavigation.loadURI(url, 0L, null, 
/* 1237 */       null, null);
/*      */ 
/* 1265 */     return true;
/*      */   }
/*      */ 
/*      */   public void stop()
/*      */   {
/* 1282 */     checkWidget();
/* 1283 */     nsIWebNavigation webNavigation = (nsIWebNavigation)this.webBrowser
/* 1284 */       .queryInterface("{f5d9e7b0-d930-11d3-b057-00a024ffc08c}");
/* 1285 */     webNavigation.stop(3L);
/*      */   }
/*      */ 
/*      */   public nsISupports queryInterface(String aIID)
/*      */   {
/* 1293 */     if (aIID.equals("{3e5432cd-9568-4bd1-8cbe-d50aba110743}")) {
/* 1294 */       if (this.embeddingSiteWin == null)
/* 1295 */         this.embeddingSiteWin = new EmbeddingSiteWindow(this);
/* 1296 */       return this.embeddingSiteWin;
/*      */     }
/* 1298 */     return Mozilla.queryInterface(this, aIID);
/*      */   }
/*      */ 
/*      */   public nsISupports queryReferent(String riid)
/*      */   {
/* 1305 */     return queryInterface(riid);
/*      */   }
/*      */ 
/*      */   public nsISupports getInterface(String riid)
/*      */   {
/* 1311 */     if (riid.equals("{a6cf906b-15b3-11d2-932e-00805f8add32}")) {
/* 1312 */       nsIDOMWindow contentDOMWindow = this.webBrowser.getContentDOMWindow();
/* 1313 */       return contentDOMWindow;
/*      */     }
/* 1315 */     return queryInterface(riid);
/*      */   }
/*      */ 
/*      */   public void onStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, long aStateFlags, long aStatus)
/*      */   {
/* 1322 */     if ((aStateFlags & 0x20000) == 0L)
/* 1323 */       return;
/* 1324 */     if ((aStateFlags & 1L) != 0L) {
/* 1325 */       if (this.request == null)
/* 1326 */         this.request = aRequest;
/* 1327 */     } else if ((aStateFlags & 0x2) != 0L)
/*      */     {
/* 1329 */       if ((this.request != null) && (this.request.getName().equals(aRequest.getName())))
/* 1330 */         this.request = null; 
/*      */     } else {
/* 1331 */       if (((aStateFlags & 0x10) == 0L) || (
/* 1343 */         (this.request != null) && (!(this.request.getName().equals(aRequest.getName()))))) return;
/* 1344 */       this.request = null;
/* 1345 */       StatusTextEvent event = null;
/*      */       try
/*      */       {
/* 1348 */         event = new StatusTextEvent(this);
/* 1349 */         event.display = getDisplay();
/* 1350 */         event.widget = this;
/* 1351 */         event.text = "";
/*      */       } catch (Throwable e) {
/* 1353 */         System.out.println(e.getMessage());
/* 1354 */         event = null;
/*      */       }
/* 1356 */       for (int i = 0; i < this.statusTextListeners.length; ++i) {
/* 1357 */         this.statusTextListeners[i].changed(event);
/*      */       }
/* 1359 */       ProgressEvent event2 = null;
/*      */       try
/*      */       {
/* 1362 */         event2 = new ProgressEvent(this);
/* 1363 */         event2.display = getDisplay();
/* 1364 */         event2.widget = this;
/*      */       } catch (Throwable e) {
/* 1366 */         System.out.println(e.getMessage());
/* 1367 */         event = null;
/*      */       }
/*      */ 
/* 1370 */       for (int i = 0; i < this.progressListeners.length; ++i)
/* 1371 */         this.progressListeners[i].completed(event2);
/*      */     }
/*      */   }
/*      */ 
/*      */   public void onProgressChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress)
/*      */   {
/* 1379 */     if (this.progressListeners.length == 0) {
/* 1380 */       return;
/*      */     }
/* 1382 */     int total = aMaxTotalProgress;
/* 1383 */     if (total <= 0)
/* 1384 */       total = 2147483647;
/* 1385 */     ProgressEvent event = null;
/*      */     try
/*      */     {
/* 1388 */       event = new ProgressEvent(this);
/* 1389 */       event.display = getDisplay();
/* 1390 */       event.widget = this;
/* 1391 */       event.current = aCurTotalProgress;
/* 1392 */       event.total = aMaxTotalProgress;
/*      */     } catch (Throwable e) {
/* 1394 */       System.out.println(e.getMessage());
/* 1395 */       event = null;
/*      */     }
/* 1397 */     for (int i = 0; i < this.progressListeners.length; ++i)
/* 1398 */       this.progressListeners[i].changed(event);
/*      */   }
/*      */ 
/*      */   public void onLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation)
/*      */   {
/* 1412 */     if ((this.request != null) && (this.request != aRequest)) {
/* 1413 */       this.request = aRequest;
/*      */     }
/* 1415 */     if (this.locationListeners.length == 0) {
/* 1416 */       return;
/*      */     }
/* 1418 */     nsIDOMWindow domWindow = aWebProgress.getDOMWindow();
/* 1419 */     nsIDOMWindow topWindow = domWindow.getTop();
/*      */ 
/* 1421 */     String spec = aLocation.getSpec();
/*      */ 
/* 1423 */     System.out.println("Will load this url: " + spec + "  " + 
/* 1424 */       this.locationListeners.length);
/*      */ 
/* 1426 */     LocationEvent event = null;
/*      */     try
/*      */     {
/* 1429 */       event = new LocationEvent(this);
/* 1430 */       event.display = getDisplay();
/* 1431 */       event.widget = this;
/* 1432 */       event.location = spec;
/* 1433 */       event.top = (topWindow == domWindow);
/*      */     } catch (Throwable e) {
/* 1435 */       System.out.println(e.getMessage());
/* 1436 */       event = null;
/*      */     }
/*      */ 
/* 1439 */     for (int i = 0; i < this.locationListeners.length; ++i)
/* 1440 */       this.locationListeners[i].changed(event);
/*      */   }
/*      */ 
/*      */   public void onStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, long aStatus, String aMessage)
/*      */   {
/* 1456 */     String reqName = aRequest.getName();
/* 1457 */     if (reqName.startsWith("https:"))
/*      */     {
/* 1459 */       aRequest.cancel(-2142568446L);
/* 1460 */       return;
/*      */     }
/*      */ 
/* 1463 */     if (this.statusTextListeners.length == 0) {
/* 1464 */       return;
/*      */     }
/* 1466 */     StatusTextEvent event = null;
/*      */     try
/*      */     {
/* 1469 */       event = new StatusTextEvent(this);
/* 1470 */       event.display = getDisplay();
/* 1471 */       event.widget = this;
/* 1472 */       event.text = aMessage;
/*      */     } catch (Throwable e) {
/* 1474 */       System.out.println(e.getMessage());
/* 1475 */       event = null;
/*      */     }
/*      */ 
/* 1478 */     for (int i = 0; i < this.statusTextListeners.length; ++i)
/* 1479 */       this.statusTextListeners[i].changed(event);
/*      */   }
/*      */ 
/*      */   public void onSecurityChange(nsIWebProgress aWebProgress, nsIRequest aRequest, long state)
/*      */   {
/*      */   }
/*      */ 
/*      */   public void setStatus(long statusType, String status)
/*      */   {
/* 1489 */     StatusTextEvent event = null;
/*      */     try
/*      */     {
/* 1492 */       event = new StatusTextEvent(this);
/* 1493 */       event.display = getDisplay();
/* 1494 */       event.widget = this;
/* 1495 */       event.text = status;
/*      */     } catch (Throwable e) {
/* 1497 */       System.out.println(e.getMessage());
/* 1498 */       event = null;
/*      */     }
/*      */ 
/* 1501 */     for (int i = 0; i < this.statusTextListeners.length; ++i)
/* 1502 */       this.statusTextListeners[i].changed(event);
/*      */   }
/*      */ 
/*      */   public nsIWebBrowser getWebBrowser() {
/* 1506 */     return this.webBrowser;
/*      */   }
/*      */ 
/*      */   public void setWebBrowser(nsIWebBrowser aWebBrowser) {
/* 1510 */     this.webBrowser = aWebBrowser;
/*      */   }
/*      */ 
/*      */   public long getChromeFlags() {
/* 1514 */     return this.chromeFlags;
/*      */   }
/*      */ 
/*      */   public void setChromeFlags(long aChromeFlags) {
/* 1518 */     this.chromeFlags = aChromeFlags;
/*      */   }
/*      */ 
/*      */   public void destroyBrowserWindow() {
/* 1522 */     MozillaWindowEvent newEvent = new MozillaWindowEvent(this);
/* 1523 */     newEvent.display = getDisplay();
/* 1524 */     newEvent.widget = this;
/* 1525 */     for (int i = 0; i < this.closeWindowListeners.length; ++i) {
/* 1526 */       this.closeWindowListeners[i].close(newEvent);
/*      */     }
/*      */ 
/* 1534 */     dispose();
/*      */   }
/*      */ 
/*      */   public void sizeBrowserTo(int aCX, int aCY) {
/* 1538 */     this.size = new Point(aCX, aCY);
/*      */   }
/*      */ 
/*      */   public void showAsModal() {
/* 1542 */     throw new RuntimeException("Not implemented.");
/*      */   }
/*      */ 
/*      */   public boolean isWindowModal()
/*      */   {
/* 1547 */     return false;
/*      */   }
/*      */ 
/*      */   public void exitModalEventLoop(long aStatus)
/*      */   {
/*      */   }
/*      */ 
/*      */   public void focusNextElement()
/*      */   {
/* 1563 */     getDisplay().asyncExec(new Runnable() {
/*      */       public void run() {
/* 1565 */         AbstractMozillaBrowser.this.traverse(16);
/*      */       }
/*      */     });
/*      */   }
/*      */ 
/*      */   public void focusPrevElement()
/*      */   {
/* 1578 */     getDisplay().asyncExec(new Runnable() {
/*      */       public void run() {
/* 1580 */         AbstractMozillaBrowser.this.traverse(8);
/*      */       }
/*      */     });
/*      */   }
/*      */ 
/*      */   public void onShowContextMenu(long aContextFlags, nsIDOMEvent aEvent, nsIDOMNode aNode)
/*      */   {
/* 1589 */     nsIDOMMouseEvent domMouseEvent = (nsIDOMMouseEvent)aEvent
/* 1590 */       .queryInterface("{ff751edc-8b02-aae7-0010-8301838a3123}");
/* 1591 */     int screenX = domMouseEvent.getScreenX();
/* 1592 */     int screenY = domMouseEvent.getScreenY();
/*      */ 
/* 1594 */     Event event = new Event();
/* 1595 */     event.x = screenX;
/* 1596 */     event.y = screenY;
/* 1597 */     notifyListeners(35, event);
/* 1598 */     if (!(event.doit)) {
/* 1599 */       return;
/*      */     }
/* 1601 */     Menu menu = getMenu();
/* 1602 */     if ((menu != null) && (!(menu.isDisposed()))) {
/* 1603 */       if ((screenX != event.x) || (screenY != event.y)) {
/* 1604 */         menu.setLocation(event.x, event.y);
/*      */       }
/* 1606 */       menu.setVisible(true);
/*      */     }
/*      */   }
/*      */ 
/*      */   public boolean onStartURIOpen(nsIURI aURI)
/*      */   {
/* 1613 */     String spec = aURI.getSpec();
/*      */ 
/* 1625 */     boolean isHttps = spec.startsWith("https:");
/* 1626 */     if (this.locationListeners.length == 0) {
/* 1627 */       return isHttps;
/*      */     }
/*      */ 
/* 1630 */     boolean doit = !(isHttps);
/* 1631 */     if (this.request == null) {
/* 1632 */       LocationEvent event = null;
/*      */       try
/*      */       {
/* 1635 */         event = new LocationEvent(this);
/* 1636 */         event.display = getDisplay();
/* 1637 */         event.widget = this;
/* 1638 */         event.location = spec;
/* 1639 */         event.doit = doit;
/*      */       } catch (Throwable e) {
/* 1641 */         System.out.println(e.getMessage());
/* 1642 */         event = null;
/*      */       }
/*      */ 
/* 1645 */       for (int i = 0; i < this.locationListeners.length; ++i)
/* 1646 */         this.locationListeners[i].changing(event);
/* 1647 */       if (!(isHttps))
/* 1648 */         doit = event.doit;
/*      */     }
/* 1650 */     return (!(doit));
/*      */   }
/*      */ 
/*      */   public boolean doContent(String aContentType, boolean aIsContentPreferred, nsIRequest aRequest, nsIStreamListener[] aContentHandler)
/*      */   {
/* 1655 */     throw new RuntimeException("Not implemented.");
/*      */   }
/*      */ 
/*      */   public boolean isPreferred(String aContentType, String aDesiredContentType[])
			{
				if (aContentType.length() > 0)
				{
					if (aContentType.equals("application/x-vnd.mozilla.maybe-text"))
						return false;
					if (aContentType.equals("multipart/x-mixed-replace"))
						return false;
				}
				return true;
			}
/*      */ 
/*      */   public boolean canHandleContent(String aContentType, boolean aIsContentPreferred, String[] aDesiredContentType)
/*      */   {
/* 1676 */     throw new RuntimeException("Not implemented.");
/*      */   }
/*      */ 
/*      */   public nsISupports getLoadCookie() {
/* 1680 */     throw new RuntimeException("Not implemented.");
/*      */   }
/*      */ 
/*      */   public void setLoadCookie(nsISupports aLoadCookie) {
/* 1684 */     throw new RuntimeException("Not implemented.");
/*      */   }
/*      */ 
/*      */   public nsIURIContentListener getParentContentListener() {
/* 1688 */     throw new RuntimeException("Not implemented.");
/*      */   }
/*      */ 
/*      */   public void setParentContentListener(nsIURIContentListener aParentContentListener)
/*      */   {
/* 1693 */     throw new RuntimeException("Not implemented.");
/*      */   }
/*      */ 
/*      */   public void onShowTooltip(int aXCoords, int aYCoords, String aTipText)
/*      */   {
/* 1699 */     if ((this.tip != null) && (!(this.tip.isDisposed())))
/* 1700 */       this.tip.dispose();
/* 1701 */     Display display = getDisplay();
/* 1702 */     Shell parent = getShell();
/* 1703 */     this.tip = new Shell(parent, 16384);
/* 1704 */     this.tip.setLayout(new FillLayout());
/* 1705 */     Label label = new Label(this.tip, 16777216);
/* 1706 */     label.setForeground(display.getSystemColor(28));
/* 1707 */     label.setBackground(display.getSystemColor(29));
/* 1708 */     label.setText(aTipText);
/*      */ 
/* 1714 */     Point point = display.getCursorLocation();
/*      */ 
/* 1719 */     point.y += 21;
/* 1720 */     this.tip.setLocation(point);
/* 1721 */     this.tip.pack();
/* 1722 */     this.tip.setVisible(true);
/*      */   }
/*      */ 
/*      */   public void onHideTooltip() {
/* 1726 */     if ((this.tip != null) && (!(this.tip.isDisposed())))
/* 1727 */       this.tip.dispose();
/* 1728 */     this.tip = null;
/*      */   }
/*      */ 
/*      */   public nsIDOMHTMLDocument getDocument() {
/* 1732 */     nsIDOMWindow dw = this.webBrowser.getContentDOMWindow();
/*      */ 
/* 1734 */     nsIDOMDocument nsDoc = dw.getDocument();
/*      */ 
/* 1736 */     nsIDOMHTMLDocument htmldoc = (nsIDOMHTMLDocument)nsDoc
/* 1737 */       .queryInterface("{a6cf9084-15b3-11d2-932e-00805f8add32}");
/*      */ 
/* 1739 */     return htmldoc;
/*      */   }
/*      */ }
